package org.example.shop_front_api.config;

import org.example.shop_front_api.interceptor.ShopInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private ShopInterceptor shopInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(shopInterceptor)
                .addPathPatterns("/api/address/**", "/api/area/**")  // 需要拦截的接口
                .excludePathPatterns("/api/auth/login");  // 排除登录接口
    }
}